ShinyStudio is a Docker image which extends rocker/verse to include RStudio, Shiny Server, VS Code, and ShinyProxy.
ShinyStudio leverages ShinyProxy to provide:
The ShinyStudio image consists of the products described below:
The ShinyStudio stack has been verified to work on native Docker, as well as Docker Desktop for Mac and Windows.
The GitHub repo for the ShinyStudio image is used to build the image published on DockerHub. The image is great for a personal instance, a quick demo, or the building blocks for a very customized setup.
https://github.com/dm3ll3n/ShinyStudio-Image
The repo for the enhanced setup of ShinyStudio builds upon the base image to provide an example of a more enterprise-ready instance of ShinyStudio, including NGINX, InfluxDB, and control scripts.
Setup must not be run as ‘root’.
First, create a network named shinystudio-net to be shared by all spawned containers.
docker network create shinystudio-net
Then, pull and run the ShinyStudio image directly from DockerHub.
docker run --rm -it --name shinyproxy \
--network shinystudio-net \
-v /var/run/docker.sock:/var/run/docker.sock \
-e USERID=$USERID \
-e USER=$USER \
-e PASSWORD=password \
-e MOUNTPOINT="${HOME}/ShinyStudio" \
-e SITEID=default \
-p 8080:8080 \
dm3ll3n/shinystudio
docker run --rm -it --name shinyproxy `
--network shinystudio-net `
-v /var/run/docker.sock:/var/run/docker.sock `
-e USERID=1000 `
-e USER=$env:USERNAME `
-e PASSWORD=password `
-e MOUNTPOINT="/host_mnt/c/Users/$env:USERNAME/ShinyStudio" `
-e SITEID=default `
-p 8080:8080 `
dm3ll3n/shinystudio
Notice the unique form of the path for the
MOUNTPOINTvariable in the Windows setup.
Once complete, open a web browser and navigate to http://<hostname>:8080. Log in with your username and the password password.
Variables:
| Variable | Default | Explained |
|---|---|---|
| USERID | $USERID | For proper permissions, this value should not be changed. |
| USER | $USER | Username to use at the ShinyProxy login screen. |
| PASSWORD | password | Password to use at the ShinyProxy login screen. |
| MOUNTPOINT | “${HOME}/ShinyStudio” | The path to store site content and user settings. |
| SITEID | default | Defines the folder name that this site’s content will reside in ($MOUNTPOINT/sites/$SITEID). |
| ROOT | false | Grant root permission in RStudio / VS Code? Useful for testing, but changes are not persistent. |
The enhanced ShinyStudio setup requires Docker, docker-compose, and Git.
Setup must be run as a non-root user.
# Clone the master branch.
git clone https://github.com/dm3ll3n/ShinyStudio
# Enter the new directory.
cd ShinyStudio
./control.sh setup
./control.ps1 setup
The default mountpoint is $PWD/content. To specify another mountpoint, pass the desired path as an argument to the setup:
./control.[sh|ps1] setup "$HOME/ShinyStudio"
Once complete, open a web browser and navigate to http://<hostname>:8080.
The default logins are:
| username | password |
|---|---|
| user | user |
| admin | admin |
| superadmin | superadmin |
Open your IDE of choice and notice two important directories:
Files must be saved in either of these two directories in order to persist between sessions.
These two folders are shared between instances RStudio, VS Code, and Shiny Server. So, creating new content is as simple as saving a file to the appropriate directory.
The ShinyStudio image comes with…
…and ODBC drivers for:
These are persistent because they are built into the image.
| Persistent | |
|---|---|
| __ShinyStudio__ directory | Yes |
| __Personal__ directory | Yes |
| Other directories | No |
| R Libraries | Yes |
| Python Packages | Yes |
| PowerShell Modules | Yes |
| RStudio User Settings | Yes |
| VS Code User Settings | Yes |
| Installed Apps | No |
| Installed Drivers | No |
The information below applies only to the “enhanced” setup on GitHub.
Authentication is managed by ShinyProxy, which supports basic auth, LDAP, Kerberos, and others (read more).
By default, ShinyStudio defines three levels of access:
Admin / SuperAdmin landing page:
Readers:
To apply a custom security configuration, modify the ShinyProxy configuration file for the site. All available options are detailed in the docs for ShinyProxy.
./sites/8080_Site1.yml
The site config files should follow the covention "{SITEPORT}_{SITEID}.yml“, where”SITEPORT" is the port to host the site, and “SITEID” is a unique idenfifier for the site.
Open 8080_Site1.yml and edit the following lines as desired:
authentication: simple
users:
- name: superadmin
password: *change*me*
groups: superadmins
- name: admin
password: *change*me*
groups: admins
- name: user
password: *change*me*
groups: readers
To enforce LDAP authentication, use:
ldap:
url: ldap://mydomain.com/DC=mydomain,DC=com
manager-dn: CN=svc.user,OU=Users,DC=mydomain,DC=com
manager-password: ...
user-search-base:
user-search-filter: (sAMAccountName={0})
group-search-base: OU=Groups
group-search-filter: (member={0})
After modifying any part of the configuration, stop and re-setup the site with:
Multiple instances of ShinyProxy can be mapped to different ports in order to segment content or provide unique customizations.
The configs below will setup two unique, independent instances of ShinyStudio, hosted on ports 8080, 8081.
./sites/8080_Site1.yml
./sites/8081_Site2.yml